/*
 * ec_control.h
 *
 * realize ec control.
 *
 * Copyright (C) 2024 Sinh Micro, Inc.
 * Subject to the GNU Public License, version 2.
 *
 * Author: lixiang<lixiang@sinhmicro.com>
 * 
 * Encoding format: GB2312
 * Version: v1.2.2
 * Date: 2024-11-05
 */

#include "hal-regs.h"
#include "hal/inc/types.h"
#include "ec_app_config.h"

#ifndef _HEAT_CONTROL_H_
#define _HEAT_CONTROL_H_

#define WORK_STATE_NO_HEATING           (0)
#define WORK_STATE_HEATING              (1)

#define HEATING_MAX_CNT                 (CONFIG_HEATING_MAX_CNT * 10)

extern bool ec_state;

void ec_control_handle_10ms(void);
void ec_control_handle_100ms(void);
bool is_ec_heating(void);

#if (CONFIG_MIC_TYPE > 0)
    #if (CONFIG_SMOKING_THRESHOLD < 25)
        #error("invalid CONFIG_SMOKING_THRESHOLD")
    #endif

    #if ((CONFIG_RELEASE_THRESHOLD < 1) || (CONFIG_RELEASE_THRESHOLD > 9))
        #error("invalid CONFIG_RELEASE_THRESHOLD")
    #endif

    #if ((CONFIG_MIC_TYPE == 1) && (CONFIG_SMOKING_THRESHOLD < 32))
        #error("invalid CONFIG_SMOKING_THRESHOLD")
    #endif

    #if ((CONFIG_MIC_TYPE == 2) && (CONFIG_SMOKING_THRESHOLD < 45))
        #error("invalid CONFIG_SMOKING_THRESHOLD")
    #endif
#endif

#endif